package com.sfjswl.fp.core.utils;

public final class RuleBeanUtils {

    private static RuleBeanFactory factory;

    private RuleBeanUtils() {
    }

    public static void autowireBean(Object existingBean) {
        if (factory == null) {
            return;
        }
        factory.autowireBean(existingBean);
    }

    public static boolean containsBean(String name) {
        if (factory == null) {
            return false;
        }
        return factory.containsBean(name);
    }

    public static Object getBean(String name) {
        if (factory == null) {
            return null;
        }
        return factory.getBean(name);
    }

    public static void setFactory(RuleBeanFactory factory) {
        RuleBeanUtils.factory = factory;
    }

    public interface RuleBeanFactory {

        void autowireBean(Object existingBean);

        boolean containsBean(String name);

        Object getBean(String name);
    }
}
